
<nz-spin nzTip="Loading..." [nzSpinning]="loading">
  <nz-list nzGrid *ngIf="!error">
  <div nz-row [nzGutter]="24">
    <div nz-col [nzSpan]="6" >
      <nz-list-item>
        <nz-card nzTitle="阻止全局搜索">
          <div nz-typography> <code>阻止所有用户在全局搜索中检索到网盘内容</code></div>
          <nz-switch [(ngModel)]="settings.blockSearch" nzCheckedChildren="是" nzUnCheckedChildren="否" (ngModelChange)="saveSettings()"></nz-switch>
        </nz-card>
      </nz-list-item>
    </div>
    <div nz-col [nzSpan]="9" >
      <nz-list-item>
        <nz-card nzTitle="根目录权限">
          <div nz-typography><code>注：根目录权限中的 view 将会影响到用户在共享大厅的显示</code></div>

          <span *ngIf="rootFile&&rootFile.permission else loadFailTip">
            当前权限：<nz-tag *ngIf="!rootFile.permission||!rootFile.permission.ann.open
                ||!(rootFile.permission.ann.open||rootFile.permission.user.open||rootFile.permission.custom.open)"
                    nzColor="lime">无</nz-tag>
            <nz-tag *ngIf="rootFile.permission.ann.open" nzColor="orange">ann</nz-tag>
            <nz-tag *ngIf="rootFile.permission.user.open" nzColor="green">user</nz-tag>
            <nz-tag *ngIf="rootFile.permission.custom.open" nzColor="blue">custom</nz-tag>
            <a (click)="editRootPmClick()"><i nz-icon nzType="edit" nzTheme="twotone"></i></a>
          </span>
          <ng-template #loadFailTip>
            加载中...
          </ng-template>
        </nz-card>
      </nz-list-item>
    </div>
    <div nz-col [nzSpan]="9" >
      <nz-list-item>
        <nz-card nzTitle="默认文件权限">
          <nz-radio-group [(ngModel)]="settings.defaultPmType" (ngModelChange)="saveSettings()" nzButtonStyle="solid" nzSize="default">
            <label nz-radio-button nzValue="close">关闭</label>
            <label nz-radio-button nzValue="extends">继承父目录</label>
            <label nz-radio-button nzValue="custom">自定义</label>
          </nz-radio-group>
          <div style="margin-top: 10px" *ngIf="settings.defaultPmType=='custom'">
            当前权限：<nz-tag *ngIf="!settings.defaultPermission||!settings.defaultPermission.ann?.open
                ||!(settings.defaultPermission.ann?.open||settings.defaultPermission.user?.open||settings.defaultPermission.custom?.open)"
                    nzColor="lime">无</nz-tag>
            <span *ngIf="settings.defaultPermission">
              <nz-tag *ngIf="settings.defaultPermission.ann?.open" nzColor="orange">ann</nz-tag>
              <nz-tag *ngIf="settings.defaultPermission.user?.open" nzColor="green">user</nz-tag>
              <nz-tag *ngIf="settings.defaultPermission.custom?.open" nzColor="blue">custom</nz-tag>
            </span>
            <a (click)="editDefaultPmClick()"><i nz-icon nzType="edit" nzTheme="twotone"></i></a>
          </div>
        </nz-card>
      </nz-list-item>
    </div>
  </div>
  <div nz-row [nzGutter]="24">
    <div nz-col [nzSpan]="9" >
      <nz-list-item>
        <nz-card nzTitle="用户组">
          <bby-user-group-card></bby-user-group-card>
        </nz-card>
      </nz-list-item>
    </div>
  </div>
</nz-list>
  <nz-result *ngIf="error"
             nzStatus="error"
             [nzTitle]="error.code"
             [nzSubTitle]="error.msg">
    <div nz-result-extra>
      <button nz-button nzType="primary">刷新</button>
    </div>
  </nz-result>
</nz-spin>
